-- @owner: songjing20
-- @date: 2024-09-25
-- @testpoint: 支持游标并行--smp开关打开，query_dop = 1,游标中的查询支持smp计划，声明no scroll，合理报错

--prestep1:切换A库;expect:执行成功
@conn PrimaryDbAmode;
show sql_compatibility;

--step1:开启并行参数;expect:成功
set query_dop=1;

--step2:建表;expect:成功
drop table if exists t3;
create table t3(a int, b int, c int, d bigint);
insert into t3 values(generate_series(1, 10000), generate_series(1, 10000), generate_series(1, 2), generate_series(1, 5000));
analyze t3;

--step3:设置查看游标并行计划的参数;expect:成功
set enable_auto_explain = on;
set auto_explain_level = notice;

--step4:标中的查询支持smp计划(query_dop设置=1无法支持smp计划)，声明no scroll;expect:不支持游标并行
explain (costs off) select * from t3;
begin;
declare cursor3 no scroll cursor for select * from t3;
fetch cursor3;
end;
/

--step5:清理环境expect:成功
reset query_dop;
reset enable_auto_explain;
reset auto_explain_level;
drop table t3;
